﻿<%@ Page Language="C#" enableEventValidation="false" AutoEventWireup="true" CodeBehind="EditHotel.aspx.cs" Inherits="DLV.BackEnd.Pages.EditHotel" %>
<%@ Register Src="~/Controls/TinyMCE.ascx" TagPrefix="uc1" TagName="TinyMCE" %>

<asp:content id="Content1" contentplaceholderid="placeHolderContent" runat="server">
    <div id="toolbar-box">
		<div class="t">
			<div class="t">
				<div class="t"></div>
			</div>
		</div>
		<div class="m">
		    <div id="toolbar" class="toolbar">
			    <table class="toolbar">
			        <tbody>
					    <tr>
						    <td id="toolbar-save" class="button">
						        <asp:LinkButton ID="lbtSave" runat="server" Text="" onclick="lbtSave_Click" CssClass="toolbar">
					                <span id="Span1" title="Save" class="icon-32-save" runat="server"></span>Lưu
					            </asp:LinkButton>
						    </td>
						    <td id="toolbar-cancel" class="button">
						        <asp:LinkButton ID="lbtClose" runat="server" Text="" onclick="lbtClose_Click" 
                                    CssClass="toolbar" CausesValidation="False">
					                <span id="Span2" title="Close" class="icon-32-cancel" runat="server"></span>Thoát
					            </asp:LinkButton>
						    </td>
					    </tr>
				    </tbody>
			    </table>
		    </div>
			<div class="header">Thêm mới/chỉnh sửa thông tin khách sạn</div>
			<div class="clr"></div>
		</div>
		<div class="b">
			<div class="b">
				<div class="b"></div>
			</div>
		</div>
	</div>
	<div id="element-box">
		<div class="t">
			<div class="t">
				<div class="t"></div>
			</div>
		</div>
		<div class="m" style="float:left; width:100%">
			<div class="admin-left">
                <table class="adminform">
                    <tr>
						<td colspan="2">
                            <div id="ErorMessage" style="color: Red;line-height: 150%;"></div>
                        </td>
					</tr>
                    <tr>
                        <td style="width: 20%;">Tên&nbsp;khách&nbsp;sạn:</td>
                        <td><asp:TextBox id="txtHotelFullName" runat="server" Width="400px"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td style="width: 20%;">Tên&nbsp;rút&nbsp;gọn:</td>
                        <td><asp:TextBox id="txtHotelSortName" runat="server" Width="400px"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td style="width: 20%;">Tên&nbsp;tiếng&nbsp;anh:</td>
                        <td><asp:TextBox id="txtHotelEnglishName" runat="server" Width="400px"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td style="width: 20%;">Loại khách sạn:</td>
                        <td><asp:DropDownList id="ddlHotelType" runat="server" Width="200px"></asp:DropDownList></td>
                    </tr>
                    <tr>
                        <td style="width: 20%;">Đối tác:</td>
                        <td><asp:DropDownList id="ddlPartner" runat="server" Width="200px"></asp:DropDownList></td>
                    </tr>
                    
                    <tr>
                        <td colspan="2">
                            Chi tiết về khách sạn
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <uc1:TinyMCE runat="server" ID="txtContent" />
                        </td>
                    </tr>
     
                </table>  
            </div>  
            <div class="admin-right">
                <table>
                    <tr>
                        <td class="label">Các tiện ích:</td>
                        <td style="text-align: left" >
                            <div>
                                <input type="text" onclick="openPopup('viand')" style="width:400px;" readonly="readonly" placeholder="Click để chọn tiện ích" />
                            </div>
                            <input type="hidden" id="txtUtilities" runat="server" value=""/>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 20%;">Mô tả ngắn về khách sạn:</td>
                        <td><asp:TextBox id="txtSortDesription" TextMode="MultiLine" runat="server" Width="400px" Height="100px"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td style="width: 20%;">Số tầng:</td>
                        <td><asp:TextBox id="txtFloorQuantity" runat="server" Width="400px"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td>Châu lục:</td>
                        <td>
                            <asp:DropDownList ID="ddlContinent" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>Quốc gia:</td>
                        <td>
                            <asp:DropDownList ID="ddlNational" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>Tỉnh/Thành phố:</td>
                        <td>
                            <asp:DropDownList ID="ddlCity" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>Quận/Huyện:</td>
                        <td>
                            <asp:DropDownList ID="ddlDistrict" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>Phường/Xã:</td>
                        <td>
                            <asp:DropDownList ID="ddlWard" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>Địa chỉ:</td>
                        <td>
                            <asp:TextBox ID="txtAddress" runat="server" Width="400px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 20%;">Người đại diện:</td>
                        <td><asp:TextBox id="txtRepresentName" runat="server" Width="400px"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td style="width: 20%;">Điện thoại:</td>
                        <td><asp:TextBox id="txtPhone" CssClass="validate-number" runat="server" Width="400px"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td style="width: 20%;">Hotline:</td>
                        <td><asp:TextBox id="txtHotline" CssClass="validate-number" runat="server" Width="400px"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td style="width: 20%;">Fax:</td>
                        <td><asp:TextBox id="txtFax" CssClass="validate-number" runat="server" Width="400px"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td style="width: 20%;">Email:</td>
                        <td><asp:TextBox id="txtRepresentEmail" runat="server" Width="400px"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td style="width: 20%;">Website:</td>
                        <td><asp:TextBox id="txtWebsite" runat="server" Width="400px"></asp:TextBox></td>
                    </tr>
                     <tr>
                        <td style="width: 20%;">Người tạo:</td>
                        <td><asp:DropDownList id="ddlCreatedBy" runat="server" Width="200px"></asp:DropDownList></td>
                    </tr>
                    <tr>
                        <td style="width: 20%;">Tình trạng:</td>
                        <td><asp:DropDownList id="ddlStatus" runat="server" Width="200px"></asp:DropDownList></td>
                    </tr>
                </table>
            </div>
            <div class="clr"></div>
		</div>
		<div class="b">
			<div class="b">
				<div class="b"></div>
			</div>
		</div>
	</div>
    
    
     <link href="/css/popup.css" rel="stylesheet" />
    <script src="/js/jquery.popup.js"></script>
    <div class="popup-wrapper"></div>
    <div class="popup-main popup-viand">
        <div class="popup-content">
            <div class="popup-close icon-close" onclick="closePopup('viand')"></div>
            <% foreach (DLV.Data.Entities.UtilityInfo info in UtilityList){ %>
            <div class="item">
                <input type="checkbox" name="ckss" value="<%=info.UtilityId %>">
                <span><%=info.UtilityName %></span>
            </div>
            <%} %> 
        </div>
    </div>  
    
    
     <script type="text/javascript">
         function ShowUtilities() {
             document.getElementById("search").style.display = "block";
         }
         function HideUtilities() {
             document.getElementById("search").style.display = "none";
         }
         $(document).ready(function () {
             //đỗ dữ liệu vào các checkbox (check hay ko check)
             var arrViand = $("#<%=txtUtilities.ClientID %>").val();
             var arr = arrViand.split(",", 100);
             $("input[name='ckss']").each(function () {
                 for (var i = 0; i < arr.length; i++) {
                     var x = $(this).val();
                     if (x == arr[i]) {
                         $(this).attr('checked', true);
                         break;
                     }
                 }
             });
             //xử lý sự kiên check của checkobox
             $("[name='ckss']").change(function () {
                 var str = "";
                 $("input[name='ckss']:checked").each(function (i, val) {
                     if (str == "")
                         str += $(this).val();
                     else
                         str += "," + $(this).val();
                 });

                 $("#<%=txtUtilities.ClientID %>").val(str);
            });
         });
    </script>
    

     <script src="/js/jquery.address.js"></script>
    <script type="text/javascript">
        var continentItem = $('#<%=ddlContinent.ClientID %>');
        var nationalItem = $('#<%=ddlNational.ClientID %>');
        var cityItem = $('#<%=ddlCity.ClientID %>');
        var districtItem = $('#<%=ddlDistrict.ClientID %>');
        var wardItem = $('#<%=ddlWard.ClientID %>');
        loadNational(continentItem, nationalItem, cityItem, districtItem, wardItem);
        loadCity(nationalItem, cityItem, districtItem, wardItem);
        loadDistrict(cityItem, districtItem, wardItem);
        loadWard(districtItem, wardItem);
    </script>
     <link rel="stylesheet" href="/css/datepicker/jquery.ui.all.css" />
	<script type="text/javascript" src="/js/ui/jquery.ui.core.js"></script>
	<script type="text/javascript" src="/js/ui/jquery.ui.datepicker.js"></script>
    <!-- Validate -->
    <script type="text/javascript">
        $(document).ready(function () {
            $("#<%= lbtSave.ClientID %>").click(function () {
                $("#ErorMessage").html('');

                var rtnValue = validate($("#<%= ddlContinent.ClientID %> option:selected"), $("#ErorMessage"), "Vui lòng chọn châu lục khách sạn<br\>")
                    && validateDropdown($("#<%= ddlNational.ClientID %> option:selected"), $("#ErorMessage"), "Vui lòng chọn quóc gia cho khách sạn<br\>")
                    && validateDropdown($("#<%= ddlCity.ClientID %> option:selected"), $("#ErorMessage"), "Vui lòng chọn tỉnh/thành phố khách sạn<br\>")
                    && validateDropdown($("#<%= ddlDistrict.ClientID %> option:selected"), $("#ErorMessage"), "Vui lòng chọn quận/huyện khách sạn<br\>")
                    && validateDropdown($("#<%= ddlWard.ClientID %> option:selected"), $("#ErorMessage"), "Vui lòng chọn phường/xã cho khách sạn<br\>")
                    && validate($("#<%= txtAddress.ClientID %>"), $("#ErorMessage"), "Vui lòng nhập địa chỉ cho khách sạn<br\>")
                
                    && validate($("#<%= txtHotelFullName.ClientID %>"), $("#ErorMessage"), "Vui lòng nhập tên khách sạn<br\>")
                    && validate($("#<%=txtPhone.ClientID %>"), $("#ErorMessage"), "Vui lòng nhập số điện thoại<br\>")
                    && validate($("#<%= txtRepresentEmail.ClientID %>"), $("#ErorMessage"), "Vui lòng nhập email<br\>")
                    && validate($("#<%= txtRepresentName.ClientID %>"), $("#ErorMessage"), "Vui lòng nhập tên người đại diện<br\>");

                if (jQuery.trim($("#<%= txtRepresentEmail.ClientID %>").val()) != "" && !validateEmail($("#<%= txtRepresentEmail.ClientID %>").val())) {
                    $("#ErorMessage").append("Email không đúng định dạng<br\>");
                    $("#<%= txtRepresentEmail.ClientID %>").addClass('has-error');
                    rtnValue = false;
                }

                return rtnValue;
            });
        });
    </script>
</asp:content>
